<ui:composition template="/templates/layout.xhtml"
			  xmlns="http://www.w3.org/1999/xhtml"
		      xmlns:h="http://java.sun.com/jsf/html"
		      xmlns:f="http://java.sun.com/jsf/core"
		      xmlns:ui="http://java.sun.com/jsf/facelets"
		      xmlns:c="http://java.sun.com/jstl/core"
		      xmlns:fmt="http://java.sun.com/jstl/fmt"
		      xmlns:x="http://java.sun.com/jstl/xml"
		      xmlns:fn="http://java.sun.com/jstl/functions"
		      xmlns:a4j="http://richfaces.org/a4j"
		      xmlns:rich="http://richfaces.org/rich"
		      xmlns:gape="http://componentes.gape/component/gape">
	<ui:define name="titulo">
		<h:outputText value="#{msg.applicationName} - #{msg.titleTelaBSC}" />
	</ui:define>

	<ui:define name="menu">
		<ui:include src="/menu/menuStrategicPlan.xhtml" />
	</ui:define>
	
	<ui:define name="conteudo">
		<h:panelGrid columns="2" headerClass="pathway" footerClass="FormLinhaBotoes" columnClasses="label,field">
			<f:facet name="header">
				<h:outputText value="#{msg.titleTelaBSC}" />
			</f:facet>
		</h:panelGrid>
		
      		<rich:tree switchType="ajax" icon="/files/iconeNulo.gif" iconLeaf="/files/iconeNulo.gif" componentState="#{bsc.treeState}" 
      				   ignoreDupResponses="true" eventsQueue="someUniqueIdentifier" id="treeBSC">
      			<rich:treeNodesAdaptor nodes="#{bsc.treeBSCPerspective}" var="root">
      				<rich:treeNode>
      					<h:outputText value="#{root.name}" styleClass="label_tree"/>
      				</rich:treeNode>
      				<rich:treeNodesAdaptor nodes="#{root.child}" var="perspective">
       				<rich:treeNode>
       					<h:outputText value="#{perspective.name}" styleClass="label_tree"/>
       				</rich:treeNode>
       				<rich:treeNodesAdaptor nodes="#{perspective.child}" var="goal">
       					<rich:treeNode>
       						<a4j:commandLink action="#{bsc.viewGoal}" value="#{goal.name}" styleClass="label_tree" oncomplete="javascript:Richfaces.showModalPanel('panelNewGoalBSC');" 
       										 reRender="swotElementTable, perspectiveGoal, nameGoal">
       							<f:setPropertyActionListener value="#{goal.id}" target="#{bsc.idGoal}" />
       							<f:setPropertyActionListener value="#{perspective.code}" target="#{bsc.perspectiveGoalOld}" />
       						</a4j:commandLink>
       					</rich:treeNode>
       					<rich:treeNodesAdaptor nodes="#{goal.child}" var="itemUsed">
       						<rich:treeNode>
       							<h:outputText value="#{itemUsed.name}" styleClass="label_tree"/>
       						</rich:treeNode>
       						<rich:treeNodesAdaptor nodes="#{itemUsed.child}" var="item">
       							<rich:treeNode>
       								<h:outputText value="#{item.name}" styleClass="label_tree"/>
       							</rich:treeNode>
       						</rich:treeNodesAdaptor>
       					</rich:treeNodesAdaptor>
       				</rich:treeNodesAdaptor>
       			</rich:treeNodesAdaptor>            				
      			</rich:treeNodesAdaptor>
      		</rich:tree>
		
		<h:panelGrid columns="1">						
			<rich:messages layout="list" style="color: Red; align: Center; font-size: 15px"/>						
		</h:panelGrid>		
	</ui:define>
	
	<ui:define name="menuTela">
		<ui:include src="menu.xhtml" />
	</ui:define>
	
	<ui:define name="menuNavegacaoBack">
		<gape:navigationBack mbean="#{'menu'}" metodo="#{'redirecionaTela'}" parameterValue="createBSC" parameterTarget="#{menu.menuCode}" />
	</ui:define>
	
	<ui:define name="menuNavegacaoForward">
		<gape:navigationForward mbean="#{'menu'}" metodo="#{'redirecionaTela'}" parameterValue="createStrategyMap" parameterTarget="#{menu.menuCode}" />
	</ui:define>	

	<ui:define name="includePanels">
		<ui:include src="panelNewGoalBSC.xhtml" />
	</ui:define>
</ui:composition>